﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlphaSolutionsGP.Demo_classes
{
    class GradeDemo
    {
        Grade g1;
        Grade g2;
        private string passorfail;
        private int _pass;
        private int _fail;

        public GradeDemo()
        {
            if ((testGradeNoArgConstructor()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testGradeArgConstructor()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testCreateGrade()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testGetters()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testAmmendGrade()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testRemoveGrade()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
        }

        bool testGradeNoArgConstructor()
        {
            bool success = false;
            try
            {
                g1 = new Grade();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testGradeArgConstructor()
        {
            bool success = false;
            try
            {
                g2 = new Grade(1,"20010426",19,"1999-10-01","A");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testCreateGrade()
        {
            bool success = false;
            try
            {
                g2.createGrade("20010426");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testAmmendGrade()
        {
            bool success = false;
            try
            {
                g2.amendGrade("1");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testGetters()
        {
            bool success = false;
            try
            {
                string grade = g2.AssGrade;
                int resultID = g2.ResultID;
                string dateSubmision = g2.DateSubmission;

                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testRemoveGrade()
        {
            bool success = false;
            try
            {
                g1 = new Grade();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        public int Fail
        {
            get { return _fail; }
            set { _fail = value; }
        }

        public int Pass
        {
            get { return _pass; }
            set { _pass = value; }
        }
    }
}
